package com.css.zfzx.sjcj.modules.drill.service.impl;

import com.css.bpm.platform.utils.PlatformDateUtils;
import com.css.bpm.platform.utils.PlatformSessionUtils;
import com.css.zfzx.sjcj.common.utils.ServerUtil;
import com.css.zfzx.sjcj.modules.drill.Entity.QhY02Entity;
import com.css.zfzx.sjcj.modules.drill.repository.QhY02Repository;
import com.css.zfzx.sjcj.modules.drill.service.QhService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description: zfzx-qhcj
 * @Author: lhl
 * @CreateDate: 2021/3/31 17:17
 */
@Service
public class QhServiceImpl<T> implements QhService<T> {
    @Autowired
    private QhY02Repository qhY02Repository;
    @Override
    public QhY02Entity update(T t) {
        QhY02Entity qhY02Entity=null;
        try {
            String drillId= (String) ServerUtil.getGetMethod(t,"drillId");
            qhY02Entity=qhY02Repository.findByIdAndIsValid(drillId,"1");
            qhY02Entity.setId(drillId);
            qhY02Entity.setDataState("0");
            qhY02Entity.setQualityOpinion("");
            qhY02Entity.setIsValid("1");
            qhY02Entity.setUpdateUser(PlatformSessionUtils.getUserId());
            qhY02Entity.setUpdateTime(PlatformDateUtils.getCurrentTimestamp());
            qhY02Repository.save(qhY02Entity);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return qhY02Entity;
    }
}
